<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #canvas {
            border: 1px solid;
        }
    </style>
</head>

<body>
    <canvas width="400" height="400" id="canvas">
        请升级你的服务器
    </canvas>
    <script>
            var canvasBox = document.querySelector('#canvas')
        var context = canvasBox.getContext('2d');
        context.beginPath();
        context.moveTo(100,100) // 起点
        context.lineTo(200,100)
        context.lineTo(200,300)
        // context.closePath();
        
        context.strokeStyle='#f00';
        context.stroke();
        context.beginPath();
        context.moveTo(200,200) // 起点
        context.lineTo(300,200)
        context.lineTo(300,350)
        context.closePath();
        
        context.fillStyle='#f00';
        context.fill();
    </script>
</body>

</html>